home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 590 / source / gem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-06  |  1.3 KB  |  69 lines

  1. /*************************************************************************
  2.  
  3.     Aufruf von Accessories von der Okami-Shell aus
  4.  
  5.         von Wolfram Rösler
  6.  
  7. **************************************************************************/
  8. static char _M_ID[]="@(#)gem.c  - Okami Accessory-Aufruf";
  9.  
  10. #include <osbind.h>
  11. #include <ctype.h>
  12. #include "system.c"
  13.  
  14. #define MOff()    graf_mouse(256,0)
  15. #define MOn()    graf_mouse(257,0)
  16. #define RSCFILE    "gem.rsc"
  17.  
  18. main()
  19. {
  20.   static OBJECT *Tree;
  21.   int buf[8];
  22.   char *Cmd;
  23.  
  24.   appl_init();
  25.  
  26.   /* Resourcefile laden. */
  27.   if (rsrc_load(RSCFILE)==0)
  28.   {
  29.     form_alert(1,"[3][gem:|Resource file not found][  Pity  ]");
  30.     appl_exit();
  31.     return 1;
  32.   }
  33.  
  34.   rsrc_gaddr(0,0,&Tree);
  35.  
  36.   for(;;)
  37.   {
  38.     menu_bar(Tree,1);
  39.  
  40.     /* Warten auf Menüklick... */
  41.     evnt_mesag(buf);
  42.  
  43.     if (buf[0]==10)
  44.       menu_tnormal(Tree,buf[3],1);
  45.  
  46.     menu_bar(Tree,0);
  47.  
  48.     if (buf[0]==10)
  49.     {
  50.       /* Kommando aus dem Objektbaum holen. */
  51.       Cmd = (char *)Tree[buf[4]].ob_spec;
  52.       while(isspace(*Cmd)) Cmd++;
  53.  
  54.       /* Test auf Abbruchbedingung. */
  55.       if (strncmp(Cmd,"exit",4)==0)
  56.         break;
  57.  
  58.       MOff();
  59.       system(Cmd);
  60.       MOn();
  61.     }
  62.   }
  63.   
  64.   rsrc_free();
  65.   appl_exit();
  66.  
  67.   return 0;
  68. }
  69.